#!/usr/bin/python


import  sys

import  wx

import common
	
class TestNB(wx.Notebook):
    def __init__(self, parent):
        wx.Notebook.__init__(self, parent, -1, style=
                             wx.BK_DEFAULT| wx.NB_MULTILINE
                             #wx.BK_TOP 
                             #wx.BK_BOTTOM
                             #wx.BK_LEFT
                             #wx.BK_RIGHT
                             # 
                             )
        self.log = sys.stdout

	for i in range(12):
		s=chr(i+65)
		self.AddPage(common.make_marked_win(self,s), s)

        #self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
        #self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)

    def OnPageChanged(self, event):
        old = event.GetOldSelection()
        new = event.GetSelection()
        sel = self.GetSelection()
        self.log.write('OnPageChanged,  old:%d, new:%d, sel:%d\n' % (old, new, sel))
        event.Skip()

    def OnPageChanging(self, event):
        old = event.GetOldSelection()
        new = event.GetSelection()
        sel = self.GetSelection()
        self.log.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel))
        event.Skip()

		
class MainFrame(wx.Frame):

	def __init__(me):
			
		wx.Frame.__init__(me,parent=None)
		nb=TestNB(me)
		me.Bind(wx.EVT_IDLE, me.handler)#, nb)
		
		
	def handler(me, EVT):
		#dc=wx.ScreenDC()
		dc=wx.ClientDC(me)
		
		dc.SetLogicalFunction(wx.COPY)
		
		dc.SetBrush(wx.RED_BRUSH)
		dc.SetPen(wx.GREEN_PEN)
		
		x,y=0,0
		#x,y = me.ClientToScreenXY(0,0)
		print x,y
		dc.DrawRectangle(x,y,50,50)
		
		print 'in here'
		
		EVT.Skip()
		
app = wx.PySimpleApp()
frame = MainFrame()
frame.Show()
frame.Centre()
app.MainLoop()